<?php

$lang_from_to = str_replace("<#1>", "1.0.7", $lang_update['update_from_to']);
$lang_from_to = str_replace("<#2>", "1.1.2", $lang_from_to);

if($_GET['step']=="2"){
	mysql_query("UPDATE {$db_prefix}settings SET max_version='$ver_name'");
	
	mysql_query("CREATE TABLE `{$db_prefix}gallery_albums` (
	`id` int(10) unsigned NOT NULL auto_increment,
	`name` varchar(100) NOT NULL,
	`description` text,
	`image` int(5) unsigned default NULL,
	PRIMARY KEY  (`id`)
	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;");

	mysql_query("CREATE TABLE `{$db_prefix}gallery_albums_images` (
	`id` int(10) unsigned NOT NULL auto_increment,
	`image` varchar(100) NOT NULL,
	PRIMARY KEY  (`id`)
	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;");
		
	mysql_query("ALTER TABLE `{$db_prefix}groups`
	ADD `galleryAccess` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0',
	ADD `galleryEditImage` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0',
	ADD `galleryUpload` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0';");
			
	$array_table = array(
		"Gallery_albums ".$lang_update['upd_done']."",
		"Gallery_albums_images ".$lang_update['upd_done']."",
		"Groups ".$lang_update['upd_done']."",
		"Settings ".$lang_update['upd_done']."",
		"Seo ".$lang_update['upd_done']."",
		"Rss ".$lang_update['upd_done'].""
	);
	
	$html_ok = "<form method='post' onsubmit='return check_license()' action='upgrade.php'>";
	$html_ok .= "<br /><br /><div style='font: 16px Arial; font-weight: bold;'>";
	$html_ok .= "<center><input type='submit' class='img-submit' value='".$lang['submit_ok']."'/></center>";
	$html_ok .= "</form>";
	
}else{
	echo "<form method='post' onsubmit='return check_license()' action='upgrade.php?step=2'>";
	echo "<br /><br /><br /><br /><div style='font: 16px Arial; font-weight: bold;'>";
	echo "<center>".$lang_from_to."</center></div><br /><br /><br /><br />";
	echo "<input type='hidden' name='ver_name' value='1.1.2'/><div>";
	echo "<center><input type='submit' class='img-submit' value='".$lang['submit_ok']."'/></center>";
	echo "</form>";
}
?>